home *** CD-ROM | disk | FTP | other *** search
/ EuroCD 3 / EuroCD 3.iso / Programming / Amos / AMOSList-0497 / AMOSLIST / text0134.txt < prev    next >
Encoding:
Text File  |  1998-06-24  |  1.9 KB  |  55 lines

  1. On 15-Apr-97, Mush sat on a keyboard and produced this mess:
  2.  
  3. > >> OK, ill try and explain this problem again. Im making a perspective
  4. > >> box/rectangle, so naturally, one end will be close, and the other end
  5. > >> smaller, so simulate the depth of the box. Here is an example: (crap
  6. > ASCII art)
  7. > >> 
  8. > >>                        |
  9. > >>                        |
  10. > >>                        |                                  |
  11. > >>                        |                                  |
  12. > >>                        |
  13. > >>                        |
  14.  
  15. > >Surely, if you have already drawn the vertical lines on screen, all the
  16. > >necessary co-ords will be contained within the variables that set them?
  17. > >
  18. > >Or have I mis-understood?
  19.  
  20. > I know the top coords of the 2 lines drawn, but it is the top and bottom Y
  21. > coordinates on the actual SLOPES that I need to know quickly
  22.  
  23. OK, I think I understand this problem now. Hopefully, this program
  24. should solve your problem...
  25.  
  26. X1=10     : X2=95     : Rem Left and right edge x positions
  27. YTOP1=30  : YTOP2=50  : Rem Top coordinates
  28. YBOT1=150 : YBOT2=115 : Rem Bottom coordinates 
  29.  
  30. ' Draw verticle sides  
  31. Draw X1,YTOP1 To X1,YBOT1
  32. Draw X2,YTOP2 To X2,YBOT2
  33.  
  34. ' Get gradients of lines (*256 so it is int and power of 2 for speed)
  35. GRADTOP=(256*(YTOP2-YTOP1))/(X2-X1)
  36. GRADBOT=(256*(YBOT2-YBOT1))/(X2-X1)
  37.  
  38. For X=X1 To X2
  39.    ' Get coordinates at current x position
  40.    YTOP=YTOP1+((X-X1)*GRADTOP)/256
  41.    YBOT=YBOT1+((X-X1)*GRADBOT)/256
  42.    ' Plot the top and bottom points 
  43.    Plot X,YTOP
  44.    Plot X,YBOT
  45. Next X
  46.  
  47. Bye ____________________________________________________
  48.    /                                                    \
  49.   / Ben Wyatt - bwyatt@paston.co.uk or b.wyatt@uea.ac.uk \
  50.   \   http://www.paston.co.uk/users/bwyatt/index.html    /
  51.    \____________________________________________________/
  52.         (c)1995-97 Very Interesting Signatures Ltd.
  53.  
  54.  
  55.